package org.example.trainTicketSystem.DTO;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
public class TrainScheduleDTO {

    @NotBlank(message = "车次号不能为空")
    @Pattern(regexp = "^[A-Za-z0-9]{1,10}$", message = "车次号只能包含字母和数字，且长度在1-10位之间")
    private String trainNumber;

    @NotBlank(message = "起始站不能为空")
    private String startStation;

    @NotBlank(message = "终点站不能为空")
    private String endStation;

    @NotNull(message = "出发时间不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private LocalDateTime departureTime;

    @NotNull(message = "到达时间不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private LocalDateTime arrivalTime;

}
